for(var j=1;j<=9;j++){
    var result = "";
    for(var i=1;i<=j;i++){
        result += (i+" * "+j+" = "+i*j+(i*j>9?" ":"   "));
    }
    console.log(result);
}
